package com.js.nickcar.entity.local;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.UUID;

/**
 * Created by LZY on 2017/10/8.
 */

public class UploadPhotoBean implements Parcelable {

    public static final int STATE_INIT = 0;
    public static final int STATE_UPLOADING = 1;
    public static final int STATE_FAIL = 2;
    public static final int STATE_SUCCESS = 3;

    private String id = UUID.randomUUID().toString();
    private String localPath;
    private String remotePath;
    private String md5;
    private int state = STATE_INIT;
    private String type;

    public String getId() {
        return id;
    }

    public String getLocalPath() {
        return localPath;
    }

    public void setLocalPath(String localPath) {
        this.localPath = localPath;
    }

    public String getRemotePath() {
        return remotePath;
    }

    public void setRemotePath(String remotePath) {
        this.remotePath = remotePath;
    }

    public String getMd5() {
        return md5;
    }

    public void setMd5(String md5) {
        this.md5 = md5;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    @Override
    public String toString() {
        return "UploadPhotoBean{" +
                "id='" + id + '\'' +
                ", localPath='" + localPath + '\'' +
                ", remotePath='" + remotePath + '\'' +
                ", md5='" + md5 + '\'' +
                ", state=" + state +
                ", type='" + type + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object object) {
        if (this == object) return true;
        if (object == null || getClass() != object.getClass()) return false;

        UploadPhotoBean that = (UploadPhotoBean) object;

        return id.equals(that.id);

    }

    @Override
    public int hashCode() {
        return id.hashCode();
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.id);
        dest.writeString(this.localPath);
        dest.writeString(this.remotePath);
        dest.writeString(this.md5);
        dest.writeInt(this.state);
        dest.writeString(this.type);
    }

    public UploadPhotoBean() {
    }

    protected UploadPhotoBean(Parcel in) {
        this.id = in.readString();
        this.localPath = in.readString();
        this.remotePath = in.readString();
        this.md5 = in.readString();
        this.state = in.readInt();
        this.type = in.readString();
    }

    public static final Creator<UploadPhotoBean> CREATOR = new Creator<UploadPhotoBean>() {
        @Override
        public UploadPhotoBean createFromParcel(Parcel source) {
            return new UploadPhotoBean(source);
        }

        @Override
        public UploadPhotoBean[] newArray(int size) {
            return new UploadPhotoBean[size];
        }
    };
}
